#pragma once
#include "Algorithm.h"
#include "SystemView.h"
#include "GradientDescent.h"
#include <list>
#include <map>
#include <string>

using namespace std;

class NextAlgo : public Algorithm
{
private:

	double G;	// geometric factor
	int L;		// horizon - currently infinite
	GradientDescent* GD;		// the priority changing algorithm
	int findOldPlace(ExtentStatsAlgo*);
	void createSortedExtents(vector<ExtentEntry*>* extents, int timeToDelete, int currentTime);
	void addToSorted(vector<ExtentEntry*>::iterator itList);
	bool alreadyExistsInSortedExtents(ExtentEntry* ex);
	double divisionOfPriorityGroup(vector<ExtentStatsAlgo*>* l, int groupNo, int time);
	
public:
	
	NextAlgo(SystemView* sys, int sortType, Writer* w, Parser* prs, double constantG, int noTimeSlices);
	virtual ~NextAlgo(void);
	void runAlgo(int iteration);
	
};
